import time


def gettime(func):
    def inner(*args, **kwargs):
        begin = time.time()
        rst = func(*args, **kwargs)
        end = time.time()
        print("运行函数花费了%s秒" %(end - begin))
        return rst
    return inner


@gettime
def func1(name):
    print("%s 函数运行开始" % name)
    for i in range(5):
        print(f"{i}运行中")
        time.sleep(1)
    print("%s 函数运行结束" % name)

func1("xxx")